using System;
using System.Data;
using Utils;
using Utils.DatabaseUtils;


namespace QLBH
{
public class tblChucNangUI
{ 
	private int idChucNang;
	public int IdChucNang
	{
		get { return idChucNang;}
		set { idChucNang = value;}
	}

	private String tenChucNang;
	public String TenChucNang
	{
		get { return tenChucNang;}
		set { tenChucNang = value;}
	}

	private int chucNangCha;
	public int ChucNangCha
	{
		get { return chucNangCha;}
		set { chucNangCha = value;}
	}

	private int imagesIndex;
	public int ImagesIndex
	{
		get { return imagesIndex;}
		set { imagesIndex = value;}
	}

	private int thuTu;
	public int ThuTu
	{
		get { return thuTu;}
		set { thuTu = value;}
	}

	public tblChucNangUI() {}

	public tblChucNangUI(int idChucNang, String tenChucNang, int chucNangCha, int imagesIndex, int thuTu)
	 {
		this.idChucNang = idChucNang;
 		this.tenChucNang = tenChucNang;
 		this.chucNangCha = chucNangCha;
 		this.imagesIndex = imagesIndex;
 		this.thuTu = thuTu;
 	}

	public int Add(String tenChucNang, int chucNangCha, int imagesIndex, int thuTu)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblChucNang_Add",tenChucNang,chucNangCha,imagesIndex,thuTu);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Update(int idChucNang, String tenChucNang, int chucNangCha, int imagesIndex, int thuTu)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblChucNang_Update",idChucNang,tenChucNang,chucNangCha,imagesIndex,thuTu);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Delete(int idChucNang)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblChucNang_Delete",idChucNang);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int DeleteAll()
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblChucNang_DeleteAll");
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public DataSet Get(int idChucNang)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblChucNang_Get",idChucNang);
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetAll()
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblChucNang_GetAll");
			return result;
		}
		catch(Exception e) {return null; }
	}

} 
}
